<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
</head>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <input type="hidden" id="id" name="id">
    <fieldset>
        <div class="form-group">
            <label class="col-md-2 control-label">标题</label>
            <div class="col-md-10">
                <input class="form-control" placeholder="标题" type="text" name="subject" id="subject">
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-2 control-label">收件人</label>
            <div class="col-md-10">
                <input class="form-control" placeholder="收件人" type="text" name="toEmail" id="toEmail">
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-2 control-label">内容</label>
            <div class="col-md-10">
					<textarea class="layui-textarea" id="demo" style="display: none">
					</textarea>
            </div>
        </div>
    </fieldset>
</div>
<script src="../../js/constant.js"></script>
<script type="text/javascript" src="../../js/libs/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>

<script type="text/javascript">
    var layedit, index;
    layui.use(['layedit','upload'], function(){
        layedit = layui.layedit;
        index = layedit.build('demo',{tool:[]});
    });
    initData();

    function initData(){
        var id = getUrlParam("id");
        if(id != ""){
            $.ajax({
                type : 'get',
                url : domainName + '/api-b/mails/' +id,
                async : false,
                success : function(data) {
                    $("#id").val(data.id);
                    $("#toEmail").val(data.toEmail);
                    $("#subject").val(data.subject);
                    $("#demo").text(data.content);
                }
            });
        }
    }

</script>
</body>
</html>